<template>
    <div>
        <v-header @goPersonal="tomy()"></v-header>
        <div class="index_box">
            <div class="index_item" v-for="(item,index) in list" :key="index" @click="toindex(item.cid)">
                <img :src="item.ico" alt=""> <br/>{{item.title}}
            </div>
        </div>
        <v-footer opacity="1" @judge="topay('renewal',0)" :member="status"></v-footer>
    </div>
</template>
<script>
import footer  from '@/components/common/footer'
import header from '@/components/common/header'
import getUrlParam from '../../store/modules/getUrlParam'
import cookie from '../../store/modules/cookie'
import wx from 'weixin-js-sdk'
export default {
    components:{
        'v-header': header,
        'v-footer':footer
    },
    data(){
        return{
            list:[],
            status:0,
            loation:{
                latitude:"",//纬度
                longitude:"" //经度
            }
        }
    },
    created(){
        let openid = cookie.getCookie('openid')
        this.getdata()
        this.checkmember(openid)
    },
    methods:{
        getdata(){
            this.$http.get('user/index/getcategory').then((res)=>{
                if(res.code == 0){
                    this.list = res.data
                }else{
                    this.$toast(res.msg)
                }
            })
        },
        toindex(id){
            let that = this
            this.$router.push({
                path: '/list',
                query: {
                    cateid: id,
                    // latitude:that.loation.latitude,
                    // longitude: that.loation.longitude
                }
            })
        },
        checkmember(openid){
            let that = this
            this.$http.get('/user/index/getMemberType',{openid:openid}).then((res)=>{
                if(res.code == 0){
                    //数据赋值
                    that.status = res.data.status
                }
            })
        },
        tomy(){            
            this.$router.push({
                path:'/my'
            })            
        },
        topay(path,typeid){
            if(this.status ==-1){
                this.$router.push({
                    path:path,
                    query:{
                        typeid:typeid
                    }
                })
            }    
        },
    }
}
</script>
<style scoped>
.index_box{
    display: flex;
    flex-wrap:wrap;
    margin-top:122px ;
    margin-bottom: 244px;
}
.index_item{
    flex: 0 0 25%;
    color: #231815;
    font-size: 40px;
    margin-bottom: 110px;
    text-align: center;
}
.index_item img{
    width: 129px;
    height: 112px;
    margin-bottom:91px;
}

</style>